"""
========
Ballista
========

Ballista is a tiny, Python-based web application framework designed to make (mainly through CGI) a little less painful. This file is merely a setup file which uses Distutils to make everything nice and easy. For a default install, simply run ``python setup.py install``, for more information, see the Distutils documentation_.

.. _documentation: http://docs.python.org/inst/

"""

import os

from distutils.core import setup

def to_include(search='.'):
    """
    to_include
    ==========
    
    to_include(search='.') -> tuple(packages, files)
    Generate a list of directory ``search`` packages and data files to include in a distutils setup. Heavily inspired by Django's setup.py, so kudos for the great idea!
    
    """
    packages, data = [], []
    for path, dirs, files in os.walk(search):
        for directory in dirs:
            if directory.startswith('.'):
                del dirs[dirs.index(directory)]

        if '__init__.py' in files:
            packages.append(path.replace('/', '.'))
        else:
            data.append((path, [os.path.join(path, item) for item in files]))

    return packages, data

packages, data_files = to_include('ballista')
setup(
    name='Ballista',
    version='0.1',
    author='Veracon',
    author_email='veracon@veracon.net',
    url='http://dev.antisen.se/ballista',
    description='A tiny, Python-based web application framework designed to make serving through CGI a little less painful.',
    packages=packages,
    data_files=data_files
)
